//
//  MyAdvisoryOrderFinishEntranceCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/4/11.
//  Copyright © 2020 QDSG. All rights reserved.
//

import UIKit

class MyAdvisoryOrderFinishEntranceCell: UITableViewCell {
    
    
    private lazy var newStarRatingView: YSGNurseAppointMentStarRatingView = {

        let view = UINib.loadViewFrom(YSGNurseAppointMentStarRatingView.self)
        view.frame = CGRect(x: 16, y: 0, width: self.contentView.width - 32, height: 226)
        view.starRatingView.clickEnable = false
        view.starRatingView.slideEnable = false
        view.layer.cornerRadius = 16
        view.textView?.isEditable = false
        view.titleLabel.textColor = .textLight
        view.titleLabel.text = "评价"
        view.titleLabel.font = UIFont.systemFont(ofSize: 14)
        view.textView?.placeholderText = ""
        view.isHidden = true
        return view
    }()
    
    func updateData(vm: MyAdvisoryOrderFinishViewModel, indexPath: IndexPath) {
        titleLabel.text = vm.titleForEntrance(indexPath: indexPath)
        starRatingView.isHidden = vm.starViewIsHidden(indexPath: indexPath)
        starRatingView.currentStarCount = vm.score
        arrowRight.isHidden = vm.arrowRightIsHidden(indexPath: indexPath)
        if vm.score > 0 {
            
            self.contentView.addSubview(newStarRatingView)
            newStarRatingView.isHidden = vm.starViewIsHidden(indexPath: indexPath)
            newStarRatingView.textView?.text = vm.comment
            newStarRatingView.starRatingView.currentStarCount = vm.score
        }
    }

    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var starRatingView: StarRatingView!
    @IBOutlet weak var arrowRight: UIImageView!
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
